home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / man.n / history.n < prev    next >
Text File  |  1995-07-17  |  11KB  |  363 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/history.n,v 1.1 93/05/03 17:09:47 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .\" The definitions below are for supplemental macros used in Tcl/Tk
  24. .\" manual entries.
  25. .\"
  26. .\" .HS name section [date [version]]
  27. .\"    Replacement for .TH in other man pages.  See below for valid
  28. .\"    section names.
  29. .\"
  30. .\" .AP type name in/out [indent]
  31. .\"    Start paragraph describing an argument to a library procedure.
  32. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  33. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  34. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  35. .\"    needed;  use .AS below instead)
  36. .\"
  37. .\" .AS [type [name]]
  38. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  39. .\"    name are examples of largest possible arguments that will be passed
  40. .\"    to .AP later.  If args are omitted, default tab stops are used.
  41. .\"
  42. .\" .BS
  43. .\"    Start box enclosure.  From here until next .BE, everything will be
  44. .\"    enclosed in one large box.
  45. .\"
  46. .\" .BE
  47. .\"    End of box enclosure.
  48. .\"
  49. .\" .VS
  50. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  51. .\"    of man pages.
  52. .\"
  53. .\" .VE
  54. .\"    End of vertical sidebar.
  55. .\"
  56. .\" .DS
  57. .\"    Begin an indented unfilled display.
  58. .\"
  59. .\" .DE
  60. .\"    End of indented unfilled display.
  61. .\"
  62. '\"    # Heading for Tcl/Tk man pages
  63. .de HS
  64. .ds ^3 \\0
  65. .if !"\\$3"" .ds ^3 \\$3
  66. .if '\\$2'cmds'       .TH \\$1 1 \\*(^3 \\$4
  67. .if '\\$2'lib'        .TH \\$1 3 \\*(^3 \\$4
  68. .if '\\$2'tcl'        .TH \\$1 n \\*(^3 Tcl "Tcl Built-In Commands"
  69. .if '\\$2'tk'         .TH \\$1 n \\*(^3 Tk "Tk Commands"
  70. .if '\\$2'tclc'        .TH \\$1 3 \\*(^3 Tcl "Tcl Library Procedures"
  71. .if '\\$2'tkc'         .TH \\$1 3 \\*(^3 Tk "Tk Library Procedures"
  72. .if '\\$2'tclcmds'         .TH \\$1 1 \\*(^3 Tk "Tcl Applications"
  73. .if '\\$2'tkcmds'         .TH \\$1 1 \\*(^3 Tk "Tk Applications"
  74. .if t .wh -1.3i ^B
  75. .nr ^l \\n(.l
  76. .ad b
  77. ..
  78. '\"    # Start an argument description
  79. .de AP
  80. .ie !"\\$4"" .TP \\$4
  81. .el \{\
  82. .   ie !"\\$2"" .TP \\n()Cu
  83. .   el          .TP 15
  84. .\}
  85. .ie !"\\$3"" \{\
  86. .ta \\n()Au \\n()Bu
  87. \&\\$1    \\fI\\$2\\fP    (\\$3)
  88. .\".b
  89. .\}
  90. .el \{\
  91. .br
  92. .ie !"\\$2"" \{\
  93. \&\\$1    \\fI\\$2\\fP
  94. .\}
  95. .el \{\
  96. \&\\fI\\$1\\fP
  97. .\}
  98. .\}
  99. ..
  100. '\"    # define tabbing values for .AP
  101. .de AS
  102. .nr )A 10n
  103. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  104. .nr )B \\n()Au+15n
  105. .\"
  106. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  107. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  108. ..
  109. '\"    # BS - start boxed text
  110. '\"    # ^y = starting y location
  111. '\"    # ^b = 1
  112. .de BS
  113. .br
  114. .mk ^y
  115. .nr ^b 1u
  116. .if n .nf
  117. .if n .ti 0
  118. .if n \l'\\n(.lu\(ul'
  119. .if n .fi
  120. ..
  121. '\"    # BE - end boxed text (draw box now)
  122. .de BE
  123. .nf
  124. .ti 0
  125. .mk ^t
  126. .ie n \l'\\n(^lu\(ul'
  127. .el \{\
  128. .\"    Draw four-sided box normally, but don't draw top of
  129. .\"    box if the box started on an earlier page.
  130. .ie !\\n(^b-1 \{\
  131. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  132. .\}
  133. .el \}\
  134. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  135. .\}
  136. .\}
  137. .fi
  138. .br
  139. .nr ^b 0
  140. ..
  141. '\"    # VS - start vertical sidebar
  142. '\"    # ^Y = starting y location
  143. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  144. .de VS
  145. .mk ^Y
  146. .ie n 'mc \s12\(br\s0
  147. .el .nr ^v 1u
  148. ..
  149. '\"    # VE - end of vertical sidebar
  150. .de VE
  151. .ie n 'mc
  152. .el \{\
  153. .ev 2
  154. .nf
  155. .ti 0
  156. .mk ^t
  157. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  158. .sp -1
  159. .fi
  160. .ev
  161. .\}
  162. .nr ^v 0
  163. ..
  164. '\"    # Special macro to handle page bottom:  finish off current
  165. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  166. '\"    # page bottom macro.
  167. .de ^B
  168. .ev 2
  169. 'ti 0
  170. 'nf
  171. .mk ^t
  172. .if \\n(^b \{\
  173. .\"    Draw three-sided box if this is the box's first page,
  174. .\"    draw two sides but no top otherwise.
  175. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  176. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  177. .\}
  178. .if \\n(^v \{\
  179. .nr ^x \\n(^tu+1v-\\n(^Yu
  180. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  181. .\}
  182. .bp
  183. 'fi
  184. .ev
  185. .if \\n(^b \{\
  186. .mk ^y
  187. .nr ^b 2
  188. .\}
  189. .if \\n(^v \{\
  190. .mk ^Y
  191. .\}
  192. ..
  193. '\"    # DS - begin display
  194. .de DS
  195. .RS
  196. .nf
  197. .sp
  198. ..
  199. '\"    # DE - end display
  200. .de DE
  201. .fi
  202. .RE
  203. .sp .5
  204. ..
  205. .HS history tcl
  206. .BS
  207. '\" Note:  do not modify the .SH NAME line immediately below!
  208. .SH NAME
  209. history \- Manipulate the history list
  210. .SH SYNOPSIS
  211. \fBhistory \fR?\fIoption\fR? ?\fIarg arg ...\fR?
  212. .BE
  213.  
  214. .SH DESCRIPTION
  215. .PP
  216. The \fBhistory\fR command performs one of several operations related to
  217. recently-executed commands recorded in a history list.  Each of
  218. these recorded commands is referred to as an ``event''.  When
  219. specifying an event to the \fBhistory\fR command, the following
  220. forms may be used:
  221. .IP [1]
  222. A number:  if positive, it refers to the event with
  223. that number (all events are numbered starting at 1).  If the number
  224. is negative, it selects an event relative to the current event
  225. (\fB\-1\fR refers to the previous event, \fB\-2\fR to the one before that, and
  226. so on).
  227. .IP [2]
  228. A string:  selects the most recent event that matches the string.
  229. An event is considered to match the string either if the string is
  230. the same as the first characters of the event, or if the string
  231. matches the event in the sense of the \fBstring match\fR command.
  232. .LP
  233. The \fBhistory\fR command can take any of the following forms:
  234. .TP
  235. \fBhistory\fR
  236. Same
  237. as \fBhistory info\fR, described below.
  238. .TP
  239. \fBhistory add\fI command \fR?\fBexec\fR?
  240. Adds the \fIcommand\fR argument to the history list as a new event.  If
  241. \fBexec\fR is specified (or abbreviated) then the command is also
  242. executed and its result is returned.  If \fBexec\fR isn't specified
  243. then an empty string is returned as result.
  244. .TP
  245. \fBhistory change\fI newValue\fR ?\fIevent\fR?
  246. Replaces the value recorded for an event with \fInewValue\fR.  \fIEvent\fR
  247. specifies the event to replace, and
  248. defaults to the \fIcurrent\fR event (not event \fB\-1\fR).  This command
  249. is intended for use in commands that implement new forms of history
  250. substitution and wish to replace the current event (which invokes the
  251. substitution) with the command created through substitution.  The return
  252. value is an empty string.
  253. .TP
  254. \fBhistory event\fR ?\fIevent\fR?
  255. Returns the value of the event given by \fIevent\fR.  \fIEvent\fR
  256. defaults to \fB\-1\fR.  This command causes history revision to occur:
  257. see below for details.
  258. .TP
  259. \fBhistory info \fR?\fIcount\fR?
  260. Returns a formatted string (intended for humans to read) giving
  261. the event number and contents for each of the events in the history
  262. list except the current event.  If \fIcount\fR is specified
  263. then only the most recent \fIcount\fR events are returned.
  264. .TP
  265. \fBhistory keep \fIcount\fR
  266. This command may be used to change the size of the history list to
  267. \fIcount\fR events.  Initially, 20 events are retained in the history
  268. list.  This command returns an empty string.
  269. .TP
  270. \fBhistory nextid\fR
  271. Returns the number of the next event to be recorded
  272. in the history list.  It is useful for things like printing the
  273. event number in command-line prompts.
  274. .TP
  275. \fBhistory redo \fR?\fIevent\fR?
  276. Re-executes the command indicated by \fIevent\fR and return its result.
  277. \fIEvent\fR defaults to \fB\-1\fR.  This command results in history
  278. revision:  see below for details.
  279. .TP
  280. \fBhistory substitute \fIold new \fR?\fIevent\fR?
  281. Retrieves the command given by \fIevent\fR
  282. (\fB\-1\fR by default), replace any occurrences of \fIold\fR by
  283. \fInew\fR in the command (only simple character equality is supported;
  284. no wild cards), execute the resulting command, and return the result
  285. of that execution.  This command results in history
  286. revision:  see below for details.
  287. .TP
  288. \fBhistory words \fIselector\fR ?\fIevent\fR?
  289. Retrieves from the command given by \fIevent\fR (\fB\-1\fR by default)
  290. the words given by \fIselector\fR, and return those words in a string
  291. separated by spaces.  The \fBselector\fR argument has three forms.
  292. If it is a single number then it selects the word given by that
  293. number (\fB0\fR for the command name, \fB1\fR for its first argument,
  294. and so on).  If it consists of two numbers separated by a dash,
  295. then it selects all the arguments between those two.  Otherwise
  296. \fBselector\fR is treated as a pattern; all words matching that
  297. pattern (in the sense of \fBstring match\fR) are returned.  In
  298. the numeric forms \fB$\fR may be used
  299. to select the last word of a command.
  300. For example, suppose the most recent command in the history list is
  301. .RS
  302. .DS
  303. \fBformat  {%s is %d years old} Alice [expr $ageInMonths/12]\fR
  304. .DE
  305. Below are some history commands and the results they would produce:
  306. .DS
  307. .ta 4c
  308. .fi
  309. .UL Command "    "
  310. .UL Result
  311. .nf
  312.  
  313. \fBhistory words $    [expr $ageInMonths/12]\fR
  314. \fBhistory words 1-2    {%s is %d years  old} Alice\fR
  315. \fBhistory words *a*o*    {%s is %d years old} [expr $ageInMonths/12]\fR
  316. .DE
  317. \fBHistory words\fR results in history revision:  see below for details.
  318. .RE
  319. .SH "HISTORY REVISION"
  320. .PP
  321. The history options \fBevent\fR, \fBredo\fR, \fBsubstitute\fR,
  322. and \fBwords\fR result in ``history revision''.
  323. When one of these options is invoked then the current event
  324. is modified to eliminate the history command and replace it with
  325. the result of the history command.
  326. For example, suppose that the most recent command in the history
  327. list is
  328. .DS
  329. \fBset a [expr $b+2]\fR
  330. .DE
  331. and suppose that the next command invoked is one of the ones on
  332. the left side of the table below.  The command actually recorded in
  333. the history event will be the corresponding one on the right side
  334. of the table.
  335. .ne 1.5c
  336. .DS
  337. .ta 4c
  338. .fi
  339. .UL "Command Typed" "    "
  340. .UL "Command Recorded"
  341. .nf
  342.  
  343. \fBhistory redo    set a [expr $b+2]\fR
  344. \fBhistory s a b    set b [expr $b+2]\fR
  345. \fBset c [history w 2]    set c [expr $b+2]\fR
  346. .DE
  347. History revision is needed because event specifiers like \fB\-1\fR
  348. are only valid at a particular time:  once more events have been
  349. added to the history list a different event specifier would be
  350. needed.
  351. History revision occurs even when \fBhistory\fR is invoked
  352. indirectly from the current event (e.g. a user types a command
  353. that invokes a Tcl procedure that invokes \fBhistory\fR):  the
  354. top-level command whose execution eventually resulted in a
  355. \fBhistory\fR command is replaced.
  356. If you wish to invoke commands like \fBhistory words\fR without
  357. history revision, you can use \fBhistory event\fR to save the
  358. current history event and then use \fBhistory change\fR to
  359. restore it later.
  360.  
  361. .SH KEYWORDS
  362. event, history, record, revision
  363.